//package com.bob.springmvcmessageresolverdemo.base;
//
//import org.springframework.core.MethodParameter;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.support.WebDataBinderFactory;
//import org.springframework.web.context.request.NativeWebRequest;
//import org.springframework.web.method.support.HandlerMethodArgumentResolver;
//import org.springframework.web.method.support.ModelAndViewContainer;
//
//public class RequestJsonHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {
//
//    @Override
//    public boolean supportsParameter(MethodParameter methodParameter) {
//        return methodParameter.hasParameterAnnotation(RequestBody.class);
//    }
//
//    @Override
//    public Object resolveArgument(MethodParameter methodParameter, ModelAndViewContainer modelAndViewContainer, NativeWebRequest nativeWebRequest, WebDataBinderFactory webDataBinderFactory) throws Exception {
//        RequestBody requestJson = methodParameter.getParameterAnnotation(RequestBody.class);
//        String value = requestJson.value();
//        Class clazz = methodParameter.getParameterType();
//        String jsonData = webRequest.getParameter(value);
//        if (jsonData == null) {
//            return clazz.newInstance();
//        }
//        Object object = JSONObject.parseObject(jsonData, clazz);
//        return object;
//    }
//}
